// 计算总数
import {computed} from "vue";
import {TodoType,todoListPropsType} from "../../../type/toList";

export const useCountAll = (props:todoListPropsType)=>{

    const countAll =  computed(()=> props.todoList.length )

    // 计算已完成数量
    const count =  computed(()=> props.todoList.reduce((p:number,c:TodoType)=>{
        c.done===true?p++:p;
        return p
    },0) )

    return {
        countAll,
        count
    }
}